#pragma once

#include "RBTree.hpp"


namespace yfy
{
    template <class K>
    class set 
    {
        struct SetKeyOfT
        {
            const K& operator()(const K& key)
            {
                return key;
            }
        }; 
    public:
        //编译时，红黑树还未实例化，无法找到其内嵌重命名类型iterator，需要加入typename说明
        typedef typename RBTree<K, K, SetKeyOfT>::iterator iterator;        
        typedef typename RBTree<K, K, SetKeyOfT>::const_iterator const_iterator;

        iterator begin()
        {
            return _t.begin();
        }
        iterator end()
        {
            return _t.end();
        }

        pair<iterator, bool> Insert(const K& key)
        {
            return _t.Insert(key);
        }
    private:
        RBTree<K, K, SetKeyOfT> _t;
    };
}
